import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询客户列表
export function listCustom(query) {
  return request({
    url: '/system/custom/list',
    method: 'get',
    params: query
  })
}

// 查询客户详细
export function getCustom(customId) {
  return request({
    url: '/system/custom/' + parseStrEmpty(customId),
    method: 'get'
  })
}

// 新增客户
export function addCustom(data) {
  return request({
    url: '/system/custom',
    method: 'post',
    data: data
  })
}

// 修改客户
export function updateCustom(data) {
  return request({
    url: '/system/custom',
    method: 'put',
    data: data
  })
}

// 删除客户
export function delCustom(customId) {
  return request({
    url: '/system/custom/' + customId,
    method: 'delete'
  })
}

// 用户密码重置
export function resetUserPwd(userId, password) {
  const data = {
    userId,
    password,
  };
  return request({
    url: "/system/custom/resetPwd",
    method: "put",
    data: data,
  });
}
// 客户状态修改
export function changeCustomStatus(userId, status) {
  const data = {
    userId,
    status
  }
  return request({
    url: '/system/custom/changeCustomStatus',
    method: 'put',
    data: data
  })
}



// 审核客户
export function auditCustom(data) {
  return request({
    url: '/system/custom/audit',
    method: 'put',
    data: data
  })
}


// 获取所有已审核已注册的客户id
export function isRegisterUserlist(query) {
  return request({
    url: '/system/custom/isRegisterUserlist',
    method: 'get',
    params: query
  })
}


// 审核客户
export function setSuperior(data) {
  return request({
    url: '/system/custom/setSuperior',
    method: 'put',
    data: data
  })
}


//根据部门id获取用户id，排除自身以及自己的上级
export function getUserListByDeptId(query) {
  return request({
    url: '/system/custom/getUserListByDeptId',
    method: 'get',
    params: query
  })
}


// 修改手机号
export function updatePhone(data) {
  return request({
    url: '/system/custom/updatePhone',
    method: 'put',
    data: data
  })
}


//通过部门名称获取部门下的人员
export function getUserListByDeptName(query) {
  return request({
    url: '/system/custom/getUserListByDeptName',
    method: 'get',
    params: query
  })
}


// 查询客户列表
export function unAuditStatuslist(query) {
  return request({
    url: '/system/custom/unAuditStatuslist',
    method: 'get',
    params: query
  })
}
